<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ECharts</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <!-- 引入 echarts.js -->
    <script src="echart/echarts.common.min.js"></script>
    <script src="echart/jquery-1.9.1.min.js"></script>
    <script src="echart/json2.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="width: 800px;height:600px;"></div>
    <script type="text/javascript">
    var datacount =[];
    var databqmc = [];
    var start = '<%=request.getParameter("start")==null?"":request.getParameter("start")%>';
    var end = '<%=request.getParameter("end")==null?"":request.getParameter("end")%>';
	    $.post("TZYY",{start:start,end:end},function(data,status){
	        if(status=='success'){
	        	data = JSON.parse(data);
	        	datacount = data.count;
	        	databqmc = data.bqmc;
	        	// 基于准备好的dom，初始化echarts实例
	            var myChart = echarts.init(document.getElementById('main'));
	            // 指定图表的配置项和数据
	            option = {
				    title: {
				        text: '停诊原因分析',
				        subtext: '',
				        left: 'center'
				    },
				    tooltip: {
				        trigger: 'item',
				        formatter: '{a} <br/>{b} : {c} ({d}%)'
				    },
				    legend: {
				        orient: 'vertical',
				        left: 'left',
				        data: databqmc
				    },
				    series: [
				        {
				            name: '访问来源',
				            type: 'pie',
				            radius: '55%',
				            center: ['50%', '60%'],
				            data: datacount,
				            emphasis: {
				                itemStyle: {
				                    shadowBlur: 10,
				                    shadowOffsetX: 0,
				                    shadowColor: 'rgba(0, 0, 0, 0.5)'
				                }
				            }
				        }
				    ]
				};


	            // 使用刚指定的配置项和数据显示图表。
	            myChart.setOption(option);
	        	
	        }
      	});
        
    </script>
</body>
</body>
</html>